Fix deadline serialization, repr, and prune edge cases - #70421
Open
seanghaeli wants to merge 5 commits into
Open
Fix deadline serialization, repr, and prune edge cases#70421seanghaeli wants to merge 5 commits into
seanghaeli wants to merge 5 commits into
Conversation
Split out of apache#68919 per review: decoder __class_path routing, clear error for missing __class_path, repr guards for severed dagrun and dict-shaped interval, and prune guard for missed deadlines.
seanghaeli
marked this pull request as ready for review
July 25, 2026 00:14
…/deadline-robustness-followup-draft
seanghaeli
force-pushed
the
feature/deadline-robustness-followup
branch
from
July 28, 2026 22:32
09a9f50 to
385914d
Compare
ferruzzi
reviewed
Aug 7, 2026
| custom_class = find_registered_custom_deadline_reference(reference_data["__class_path"]) | ||
| class_path = reference_data.get("__class_path") | ||
| if not class_path: | ||
| raise ValueError( |
| # specific language governing permissions and limitations | ||
| # under the License. | ||
| """ | ||
| Adversarial QA coverage for ``Deadline.prune_deadlines``. |
Comment on lines
+95
to
+97
| def setup_method(): | ||
| _clean_db() | ||
|
|
Contributor
There was a problem hiding this comment.
If we need to clean the db before our tests, then something else is leaving artifacts that should not be there, this will hide issues.
| if TYPE_CHECKING: | ||
| from sqlalchemy.orm import Session | ||
|
|
||
| DAG_ID = "qaw18_prune_dag" |
| Adversarial QA coverage for ``Deadline.prune_deadlines``. | ||
|
|
||
| ``prune_deadlines`` is the batch-delete path the scheduler invokes (via | ||
| ``DagRun.update_state`` -> ``dagrun.py:1237``) when a DagRun completes on time: |
Contributor
There was a problem hiding this comment.
This whole docstring is odd, but the line number in particular is pretty pointless and will drift in no time, if it hasn't already.
| def test_deadline_alert_repr_does_not_raise_on_json_dict_interval( | ||
| self, deadline_alert_orm, interval, expected | ||
| ): | ||
| """``DeadlineAlert.__repr__`` must never raise for the PRODUCTION (JSON-dict) ``interval`` shape. |
Contributor
There was a problem hiding this comment.
Similar to above, we don't generally have a novel for a test docstring when the test's name is usually pretty self-documenting.
Comment on lines
+66
to
+67
| if isinstance(data, (int, float)): | ||
| interval_seconds = int(data) |
Contributor
There was a problem hiding this comment.
It might be safer to check if __classname__ == "datetime.timedelta" instead, otherwise I think this could catch a broader scope than intended. I may be overthinking this one though.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split out of #68919 per review. Edge-case fixes in the deadline model and serialization paths:
__class_pathahead ofreference_type(custom references can share a builtin's class name), and a reference with no importable__class_pathraises a clear error instead of aKeyError.__repr__onDeadlineandDeadlineAlertnever raises (guards thedagrunrelationship post-cascade-delete and the dict-shaped interval).prune_deadlinesexcludes missed deadlines so a missed deadline's queued callback is not cascade-deleted.